package com.homer.android.sdk.db.greenrobot.daos;



import com.homer.android.sdk.object.db.IDeviceDB;

import de.greenrobot.dao.DaoException;

public class DeviceDB implements IDeviceDB
{
    
    private long id;
    
    /** Not-null value. */
    private String deviceNumber;
    
    /** Not-null value. */
    private String bssid;
    
    private int type;
    
    private int state;
    
    /** Not-null value. */
    private String name;
    
    private String rom_version;
    
    private long timestamp;
    
    private long activatedTime;
    
    private long userId;
    
    /** Used to resolve relations */
    private transient DaoSession daoSession;
    
    /** Used for active entity operations. */
    private transient DeviceDBDao myDao;
    
    private UserDB userDB;
    
    private Long userDB__resolvedKey;
    
    // KEEP FIELDS - put your custom fields here
    // KEEP FIELDS END
    
    public DeviceDB()
    {
    }
    
    public DeviceDB(long id)
    {
        this.id = id;
    }
    
    public DeviceDB(long id, String deviceNumber, String bssid, int type, int state, String name,
        String rom_version, long timestamp, long activatedTime, long userId)
    {
        this.id = id;
        this.deviceNumber = deviceNumber;
        this.bssid = bssid;
        this.type = type;
        this.state = state;
        this.name = name;
        this.rom_version = rom_version;
        this.timestamp = timestamp;
        this.activatedTime = activatedTime;
        this.userId = userId;
    }
    
    /** called by internal mechanisms, do not call yourself. */
    public void __setDaoSession(DaoSession daoSession)
    {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getDeviceDBDao() : null;
    }
    
    public long getId()
    {
        return id;
    }
    
    public void setId(long id)
    {
        this.id = id;
    }
    
   
    
    public String getDeviceNumber() {
		return deviceNumber;
	}

	public void setDeviceNumber(String deviceNumber) {
		this.deviceNumber = deviceNumber;
	}

	/** Not-null value. */
    public String getBssid()
    {
        return bssid;
    }
    
    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setBssid(String bssid)
    {
        this.bssid = bssid;
    }
    
    public int getType()
    {
        return type;
    }
    
    public void setType(int type)
    {
        this.type = type;
    }
    
    public int getState()
    {
        return state;
    }
    
    public void setState(int state)
    {
        this.state = state;
    }
    
  
    
    /** Not-null value. */
    public String getName()
    {
        return name;
    }
    
    /** Not-null value; ensure this value is available before it is saved to the database. */
    public void setName(String name)
    {
        this.name = name;
    }
    
    public String getRom_version()
    {
        return rom_version;
    }
    
    public void setRom_version(String rom_version)
    {
        this.rom_version = rom_version;
    }
    
   
    
    public long getTimestamp()
    {
        return timestamp;
    }
    
    public void setTimestamp(long timestamp)
    {
        this.timestamp = timestamp;
    }
    
    public long getActivatedTime()
    {
        return activatedTime;
    }
    
    public void setActivatedTime(long activatedTime)
    {
        this.activatedTime = activatedTime;
    }
    
    public long getUserId()
    {
        return userId;
    }
    
    public void setUserId(long userId)
    {
        this.userId = userId;
    }
    
    /** To-one relationship, resolved on first access. */
    public UserDB getUserDB()
    {
        long __key = this.userId;
        if (userDB__resolvedKey == null || !userDB__resolvedKey.equals(__key))
        {
            if (daoSession == null)
            {
                throw new DaoException("Entity is detached from DAO context");
            }
            UserDBDao targetDao = daoSession.getUserDBDao();
            UserDB userDBNew = targetDao.load(__key);
            synchronized (this)
            {
                userDB = userDBNew;
                userDB__resolvedKey = __key;
            }
        }
        return userDB;
    }
    
    public void setUserDB(UserDB userDB)
    {
        if (userDB == null)
        {
            throw new DaoException("To-one property 'userId' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this)
        {
            this.userDB = userDB;
            userId = userDB.getId();
            userDB__resolvedKey = userId;
        }
    }
    
    /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
    public void delete()
    {
        if (myDao == null)
        {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    
    /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
    public void update()
    {
        if (myDao == null)
        {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    
    /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
    public void refresh()
    {
        if (myDao == null)
        {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    
    // KEEP METHODS - put your custom methods here
    // KEEP METHODS END
    
}

